DEFINITION MODULE VDIcalls;

(*
 *  Copyright (c) 1987,1988,1989 by
 *  ana-systems, Foster City, California.
 *  All Rights Reserved.
 *
 *  This software is furnished under a license and may be used and copied
 *  only  in accordance with  the  terms  of  such  license and  with the
 *  inclusion of the above copyright notice.  This software or  any other
 *  copies thereof may not be provided or otherwise made available to any
 *  other  person.   No title to and ownership of the  software is  herby
 *  transferred.
 *
 *  The information in this software is  subject to change without notice
 *  and  should  not be construed as a commitment by ana-systems.   No
 *  warranty is implied or expressed.
 *)

EXPORT QUALIFIED VOpnvwk,VClsvwk,VClrwk,VsClip,VrRecfl,VsfColor,
                 VsfInterior,VsfStyle,VBar,VswrMode,
                 VHideC,VShowC,VEnterCur,VExitCur,VHomeCur,
                 VGetPixel,VqColor,VsColor,VgText,VpLine,VslColor;

PROCEDURE VOpnvwk(VAR workin:ARRAY OF INTEGER;
                  VAR handle:INTEGER;
                  VAR workout:ARRAY OF INTEGER);
(*
 *  Programer supplies workin and workout arrays, and handle
 *  returned by GrafHandle.  The virtual workstation handle is 
 *  returned in handle and workout is filled with info about the 
 *  device.
 *  Note: GrafHandle returns the physical wkstation handle, which
 *        you should save; VOpnvwk returns the virtual wkstation
 *        handle. The two are differentiated as physHandle and
 *        handle.
 *)
 
PROCEDURE VClsvwk(handle:INTEGER);
(*
 *  Terminate output to virtual workstation.
 *)
 
PROCEDURE VClrwk(handle:INTEGER);
(*
 *  Clear the screen, or clear print buffer and do FF, etc.
 *)

PROCEDURE VsClip(handle,clipFlag:INTEGER; VAR clipRect:ARRAY OF INTEGER);
(*
 *  Turn clipping on (clipFlag=1) or off (clipFlag=0).  Must supply
 *  the clipping rectangle as the upper left and lower right
 *  points [x1,y1,x2,y2].
 *)

PROCEDURE VrRecfl(handle:INTEGER; VAR rect:ARRAY OF INTEGER);
(*
 *  Draws a filled rectangle [x1,y1,x2,y2].  Fill style is set by
 *  the Vsf_ calls.  VswrMode() and the current clipping rect also
 *  apply.  (Good for painting large areas quickly.)
 *)
 
PROCEDURE VBar(handle:INTEGER; VAR rect:ARRAY OF INTEGER);
(*
 *  Draws a filled rectangle [x1,y1,x2,y2].  Fill style is set by
 *  the Vsf_ calls.  VswrMode() and the current clipping rect also
 *  apply.
 *)

PROCEDURE VsfColor(handle,colorIndex:INTEGER):INTEGER;
(*
 *  Set fill color to the VDI 'colorIndex' passed (0=white, the background,
 *  and 1=black, the forground on mono).  colorIndex is the actual color
 *  register used for drawing -- it is NOT the control panel setting or
 *  the very lowest level hardware color register.
 *  Returns the colorIndex that was set.
 *)

PROCEDURE VsColor(handle,colorIndex:INTEGER; VAR rgb:ARRAY OF INTEGER);
(*
 *  Set the VDI colorInex (drawing pen) to the color 'rgb' --
 *  does not set the control panel.  rgb is an array of 3 integers
 *  which contains the red, green and blue levels.
 *)

PROCEDURE VqColor(handle,colorIndex,flag:INTEGER; VAR rgb:ARRAY OF INTEGER);
(*
 *  Returns the either the actual color of coloIndex (flag=1) or the
 *  last requested setting (by VsColor) of colorIndex (flag=0).
 *)
 
PROCEDURE VslColor(handle,colorIndex:INTEGER):INTEGER;
(*
 *  Set line color to the VDI 'colorIndex' passed (0=white, the background,
 *  and 1=black, the forground on mono).  colorIndex is the actual color
 *  register used for drawing -- it is NOT the control panel setting or
 *  the very lowest level hardware color register.
 *  Returns the colorIndex that was set.
 *)

PROCEDURE VGetPixel(handle,x,y:INTEGER; VAR register,colorIndex:INTEGER);
(*
 *  Returns the HARDWARE register number and the VDI colorIndex
 *  number of a specified pixel.
 *)

PROCEDURE VsfInterior(handle,style:INTEGER):INTEGER;
(*
 *  Determines the style of fill used by the fill functions.
 *  Returns the style set.
 *)

PROCEDURE VsfStyle(handle,index:INTEGER):INTEGER;
(*
 *  If style Pattern or Crosshatch is set by VsfInterior, this call
 *  sets the particular type (index) of Pattern or Crosshatch.  Returns
 *  the index set.
 *)

PROCEDURE VswrMode(handle,mode:INTEGER):INTEGER;
(*
 *  Sets the writing and drawing modes:
 *             mode = 1 replace
 *                    2 transparent
 *                    3 XOR
 *                    4 reverse transparent
 *  Returns the mode set.
 *)
 
PROCEDURE VgText(handle,x,y:INTEGER; VAR string:ARRAY OF CHAR);
(*
 *  Print a line of text at pixel (x,y).  Starts at the
 *  baseline of the leftmost character.
 *
 *  Should set VstColor and perhaps others.
 *)

PROCEDURE VpLine(handle,numPoints:INTEGER; VAR points:ARRAY OF INTEGER);
(*
 *  Draw a shape defined by the points given in 'points'.
 *  The points array is set up thus: points[0]=x1, points[1]=y1,
 *  points[2]=x2, points[3]=y2, etc. numPoints is the number of
 *  pairs, that is, (x1,y1) is one point.  Two points minimum
 *  for this function.
 *)

PROCEDURE VHideC(handle:INTEGER);
(*
 *  Hide the mouse and increment the VDI mouse hide/show counter.
 *)

PROCEDURE VShowC(handle,reset:INTEGER);
(*
 *  If 'reset' <> 0, decrement the VDI mouse hide/show counter,
 *  and show the mouse if counter = 0.
 *  If 'reset' = 0, the counter will be set to 0 and the mouse shown.
 *)

PROCEDURE VEnterCur(handle:INTEGER);
(*
 *  Clear the screen and turn on the text cursor.
 *)

PROCEDURE VExitCur(handle:INTEGER);
(*
 *  Clear the screen and turn off the text cursor.
 *)

PROCEDURE VHomeCur(handle:INTEGER);
(*
 *  Move the text cursor to home position.
 *)

END VDIcalls.
